<script setup lang="ts">
import Marquee from './components/Marquee.vue'
import BannerImage from '@/components/BannerImage.vue';
import request from '../../utils/request';
import Popular from './components/Popular.vue';
import  ProductList  from './components/ProductList.vue';
import LatesTopic from './components/Latesttopic.vue'
import { onMounted, ref } from 'vue';
let imgList = ref<{}[]>([]);
onMounted(async () => {
  const data = await request.get('/home/index');

  imgList.value = data.data.result.imageBanners;
  console.log(data.data.result);
});
</script>

<template>
  <div class="home">
    <div class="home-carousel">
      <div class="home-carousel-conent">
        <BannerImage :imgList="imgList" :duration="2000" autoPlay></BannerImage>
      </div>
    </div>

    <div class="goodies">
      <!-- 新鲜好物 -->
      <div class="fresh-goodies">
        <div class="goodies-title">
          <h3>新鲜好物<span class="title-text">新鲜出炉 品质靠谱</span></h3>
          <a href="javascript:;" class="goodies-title-a">查看全部 ></a>
        </div>
        <div class="goodies-commodity">
          <ul class="goodies-commodity-ul">
            <li class="goodies-commodity-li">
              <a class="goodies-commodity-item" href="javascript">
              <img src="../../images/new_goods_1.jpg" alt="">
              <span class="goodies-commodity-spantitle">智能环绕3D空调</span>
              <span class="goodies-commodity-price"><i class="goodies-commodity-i">￥</i>1268.00</span>
              </a>
            </li>
            <li class="goodies-commodity-li">
              <a class="goodies-commodity-item" href="javascript">
              <img src="../../images/new_goods_1.jpg" alt="">
              <span class="goodies-commodity-spantitle">智能环绕3D空调</span>
              <span class="goodies-commodity-price"><i class="goodies-commodity-i">￥</i>1268.00</span>
              </a>
            </li>
            <li class="goodies-commodity-li">
              <a class="goodies-commodity-item" href="javascript">
              <img src="../../images/new_goods_1.jpg" alt="">
              <span class="goodies-commodity-spantitle">智能环绕3D空调</span>
              <span class="goodies-commodity-price"><i class="goodies-commodity-i">￥</i>1268.00</span>
              </a>
            </li>
            <li class="goodies-commodity-li">
              <a class="goodies-commodity-item" href="javascript">
              <img src="../../images/new_goods_1.jpg" alt="">
              <span class="goodies-commodity-spantitle">智能环绕3D空调</span>
              <span class="goodies-commodity-price"><i class="goodies-commodity-i">￥</i>1268.00</span>
              </a>
            </li>
          </ul>
        </div>
      </div>
      <!-- 人气推荐 -->
      <Popular></Popular>
      <!-- 商品列表 -->
      <ProductList></ProductList>
    </div>
    <Marquee></Marquee>
    <LatesTopic></LatesTopic>
  </div>
</template>

<style scoped lang="less">
.home {
  width: 100%;
  box-sizing: border-box;
  padding: 0px;
  margin: 0px;
}
.home-carousel {
  width: 100%;
  height: 500px;
  background-color: rgb(245, 245, 245);
  position: relative;
}
.home-carousel-conent {
  display: flex;
  justify-content: center;
}

.goodies{
  background-color: #fff;
  width: 100%;
}
// 新鲜好物
.fresh-goodies {
  width: 1240px;
  height: 521px;
  margin: 0 auto;
}
.goodies-title {
  height: 115px;
  padding: 40px 0px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
h3 {
  float: left;
  height: 35px;
  line-height: 35px;
  margin-left: 6px;
  font-size: 32px;
  font-weight: 400;
  color: rgb(51, 51, 51);
}
.title-text {
  margin-left: 33px;
  font-size: 16px;
  color: rgb(153, 153, 153);
}
.goodies-title-a {
  font-size: 16px;
  color: #999;
  margin-bottom: 5px;
  &:hover {
     color: #17bb9b;
  }
}
.goodies-commodity {
  width: 100%;
  height: 406px;
}
.goodies-commodity-li {
  background-color: #f0f9f4;
  transition: all .5s;
  display: inline-block;
  width: 306px;
  height: 406px;
  text-align: center;
  transform: translateZ(0);
  &:hover {
        transform: scale(1.02);
      }
}
.goodies-commodity-item {
  background-color: #f0f9f4;
  display: inline-block;
  width: 306px;
  height: 406px;
  text-align: center;
}
.goodies-commodity-ul {
  display: flex;
  justify-content: space-between;
}
.goodies-commodity-spantitle {
  display: inline-block;
  width: 100%;
  margin: 12px 0 10px;
  font-size: 22px;
}
.goodies-commodity-price {
  font-size: 23px;
  color: #cf4444;
}
.goodies-commodity-i {
  font-size: 16px;
}
</style>
